|
39 | 39 | )
|
40 | 40 | from google.cloud.video.transcoder_v1beta1.services.transcoder_service import pagers
|
41 | 41 | from google.cloud.video.transcoder_v1beta1.services.transcoder_service import transports
|
42 |
| -from google.cloud.video.transcoder_v1beta1.services.transcoder_service.transports.base import ( |
43 |
| - _API_CORE_VERSION, |
44 |
| -) |
45 | 42 | from google.cloud.video.transcoder_v1beta1.services.transcoder_service.transports.base import (
|
46 | 43 | _GOOGLE_AUTH_VERSION,
|
47 | 44 | )
|
|
53 | 50 | import google.auth
|
54 | 51 |
|
55 | 52 |
|
56 |
| -# TODO(busunkim): Once google-api-core >= 1.26.0 is required: |
57 |
| -# - Delete all the api-core and auth "less than" test cases |
| 53 | +# TODO(busunkim): Once google-auth >= 1.25.0 is required transitively |
| 54 | +# through google-api-core: |
| 55 | +# - Delete the auth "less than" test cases |
58 | 56 | # - Delete these pytest markers (Make the "greater than or equal to" tests the default).
|
59 | 57 | requires_google_auth_lt_1_25_0 = pytest.mark.skipif(
|
60 | 58 | packaging.version.parse(_GOOGLE_AUTH_VERSION) >= packaging.version.parse("1.25.0"),
|
|
65 | 63 | reason="This test requires google-auth >= 1.25.0",
|
66 | 64 | )
|
67 | 65 |
|
68 |
| -requires_api_core_lt_1_26_0 = pytest.mark.skipif( |
69 |
| - packaging.version.parse(_API_CORE_VERSION) >= packaging.version.parse("1.26.0"), |
70 |
| - reason="This test requires google-api-core < 1.26.0", |
71 |
| -) |
72 |
| - |
73 |
| -requires_api_core_gte_1_26_0 = pytest.mark.skipif( |
74 |
| - packaging.version.parse(_API_CORE_VERSION) < packaging.version.parse("1.26.0"), |
75 |
| - reason="This test requires google-api-core >= 1.26.0", |
76 |
| -) |
77 |
| - |
78 | 66 |
|
79 | 67 | def client_cert_source_callback():
|
80 | 68 | return b"cert bytes", b"key bytes"
|
@@ -138,6 +126,18 @@ def test_transcoder_service_client_from_service_account_info(client_class):
|
138 | 126 | assert client.transport._host == "transcoder.googleapis.com:443"
|
139 | 127 |
|
140 | 128 |
|
| 129 | +@pytest.mark.parametrize( |
| 130 | + "client_class", [TranscoderServiceClient, TranscoderServiceAsyncClient,] |
| 131 | +) |
| 132 | +def test_transcoder_service_client_service_account_always_use_jwt(client_class): |
| 133 | + with mock.patch.object( |
| 134 | + service_account.Credentials, "with_always_use_jwt_access", create=True |
| 135 | + ) as use_jwt: |
| 136 | + creds = service_account.Credentials(None, None, None) |
| 137 | + client = client_class(credentials=creds) |
| 138 | + use_jwt.assert_called_with(True) |
| 139 | + |
| 140 | + |
141 | 141 | @pytest.mark.parametrize(
|
142 | 142 | "client_class", [TranscoderServiceClient, TranscoderServiceAsyncClient,]
|
143 | 143 | )
|
@@ -2693,7 +2693,6 @@ def test_transcoder_service_transport_auth_adc_old_google_auth(transport_class):
|
2693 | 2693 | (transports.TranscoderServiceGrpcAsyncIOTransport, grpc_helpers_async),
|
2694 | 2694 | ],
|
2695 | 2695 | )
|
2696 |
| -@requires_api_core_gte_1_26_0 |
2697 | 2696 | def test_transcoder_service_transport_create_channel(transport_class, grpc_helpers):
|
2698 | 2697 | # If credentials and host are not provided, the transport class should use
|
2699 | 2698 | # ADC credentials.
|
@@ -2722,79 +2721,6 @@ def test_transcoder_service_transport_create_channel(transport_class, grpc_helpe
|
2722 | 2721 | )
|
2723 | 2722 |
|
2724 | 2723 |
|
2725 |
| -@pytest.mark.parametrize( |
2726 |
| - "transport_class,grpc_helpers", |
2727 |
| - [ |
2728 |
| - (transports.TranscoderServiceGrpcTransport, grpc_helpers), |
2729 |
| - (transports.TranscoderServiceGrpcAsyncIOTransport, grpc_helpers_async), |
2730 |
| - ], |
2731 |
| -) |
2732 |
| -@requires_api_core_lt_1_26_0 |
2733 |
| -def test_transcoder_service_transport_create_channel_old_api_core( |
2734 |
| - transport_class, grpc_helpers |
2735 |
| -): |
2736 |
| - # If credentials and host are not provided, the transport class should use |
2737 |
| - # ADC credentials. |
2738 |
| - with mock.patch.object( |
2739 |
| - google.auth, "default", autospec=True |
2740 |
| - ) as adc, mock.patch.object( |
2741 |
| - grpc_helpers, "create_channel", autospec=True |
2742 |
| - ) as create_channel: |
2743 |
| - creds = ga_credentials.AnonymousCredentials() |
2744 |
| - adc.return_value = (creds, None) |
2745 |
| - transport_class(quota_project_id="octopus") |
2746 |
| - |
2747 |
| - create_channel.assert_called_with( |
2748 |
| - "transcoder.googleapis.com:443", |
2749 |
| - credentials=creds, |
2750 |
| - credentials_file=None, |
2751 |
| - quota_project_id="octopus", |
2752 |
| - scopes=("https://www.googleapis.com/auth/cloud-platform",), |
2753 |
| - ssl_credentials=None, |
2754 |
| - options=[ |
2755 |
| - ("grpc.max_send_message_length", -1), |
2756 |
| - ("grpc.max_receive_message_length", -1), |
2757 |
| - ], |
2758 |
| - ) |
2759 |
| - |
2760 |
| - |
2761 |
| -@pytest.mark.parametrize( |
2762 |
| - "transport_class,grpc_helpers", |
2763 |
| - [ |
2764 |
| - (transports.TranscoderServiceGrpcTransport, grpc_helpers), |
2765 |
| - (transports.TranscoderServiceGrpcAsyncIOTransport, grpc_helpers_async), |
2766 |
| - ], |
2767 |
| -) |
2768 |
| -@requires_api_core_lt_1_26_0 |
2769 |
| -def test_transcoder_service_transport_create_channel_user_scopes( |
2770 |
| - transport_class, grpc_helpers |
2771 |
| -): |
2772 |
| - # If credentials and host are not provided, the transport class should use |
2773 |
| - # ADC credentials. |
2774 |
| - with mock.patch.object( |
2775 |
| - google.auth, "default", autospec=True |
2776 |
| - ) as adc, mock.patch.object( |
2777 |
| - grpc_helpers, "create_channel", autospec=True |
2778 |
| - ) as create_channel: |
2779 |
| - creds = ga_credentials.AnonymousCredentials() |
2780 |
| - adc.return_value = (creds, None) |
2781 |
| - |
2782 |
| - transport_class(quota_project_id="octopus", scopes=["1", "2"]) |
2783 |
| - |
2784 |
| - create_channel.assert_called_with( |
2785 |
| - "transcoder.googleapis.com:443", |
2786 |
| - credentials=creds, |
2787 |
| - credentials_file=None, |
2788 |
| - quota_project_id="octopus", |
2789 |
| - scopes=["1", "2"], |
2790 |
| - ssl_credentials=None, |
2791 |
| - options=[ |
2792 |
| - ("grpc.max_send_message_length", -1), |
2793 |
| - ("grpc.max_receive_message_length", -1), |
2794 |
| - ], |
2795 |
| - ) |
2796 |
| - |
2797 |
| - |
2798 | 2724 | @pytest.mark.parametrize(
|
2799 | 2725 | "transport_class",
|
2800 | 2726 | [
|
|
0 commit comments