|
42 | 42 | )
|
43 | 43 | from google.cloud.channel_v1.services.cloud_channel_service import pagers
|
44 | 44 | from google.cloud.channel_v1.services.cloud_channel_service import transports
|
45 |
| -from google.cloud.channel_v1.services.cloud_channel_service.transports.base import ( |
46 |
| - _API_CORE_VERSION, |
47 |
| -) |
48 | 45 | from google.cloud.channel_v1.services.cloud_channel_service.transports.base import (
|
49 | 46 | _GOOGLE_AUTH_VERSION,
|
50 | 47 | )
|
|
65 | 62 | import google.auth
|
66 | 63 |
|
67 | 64 |
|
68 |
| -# TODO(busunkim): Once google-api-core >= 1.26.0 is required: |
69 |
| -# - Delete all the api-core and auth "less than" test cases |
| 65 | +# TODO(busunkim): Once google-auth >= 1.25.0 is required transitively |
| 66 | +# through google-api-core: |
| 67 | +# - Delete the auth "less than" test cases |
70 | 68 | # - Delete these pytest markers (Make the "greater than or equal to" tests the default).
|
71 | 69 | requires_google_auth_lt_1_25_0 = pytest.mark.skipif(
|
72 | 70 | packaging.version.parse(_GOOGLE_AUTH_VERSION) >= packaging.version.parse("1.25.0"),
|
|
77 | 75 | reason="This test requires google-auth >= 1.25.0",
|
78 | 76 | )
|
79 | 77 |
|
80 |
| -requires_api_core_lt_1_26_0 = pytest.mark.skipif( |
81 |
| - packaging.version.parse(_API_CORE_VERSION) >= packaging.version.parse("1.26.0"), |
82 |
| - reason="This test requires google-api-core < 1.26.0", |
83 |
| -) |
84 |
| - |
85 |
| -requires_api_core_gte_1_26_0 = pytest.mark.skipif( |
86 |
| - packaging.version.parse(_API_CORE_VERSION) < packaging.version.parse("1.26.0"), |
87 |
| - reason="This test requires google-api-core >= 1.26.0", |
88 |
| -) |
89 |
| - |
90 | 78 |
|
91 | 79 | def client_cert_source_callback():
|
92 | 80 | return b"cert bytes", b"key bytes"
|
@@ -150,6 +138,18 @@ def test_cloud_channel_service_client_from_service_account_info(client_class):
|
150 | 138 | assert client.transport._host == "cloudchannel.googleapis.com:443"
|
151 | 139 |
|
152 | 140 |
|
| 141 | +@pytest.mark.parametrize( |
| 142 | + "client_class", [CloudChannelServiceClient, CloudChannelServiceAsyncClient,] |
| 143 | +) |
| 144 | +def test_cloud_channel_service_client_service_account_always_use_jwt(client_class): |
| 145 | + with mock.patch.object( |
| 146 | + service_account.Credentials, "with_always_use_jwt_access", create=True |
| 147 | + ) as use_jwt: |
| 148 | + creds = service_account.Credentials(None, None, None) |
| 149 | + client = client_class(credentials=creds) |
| 150 | + use_jwt.assert_called_with(True) |
| 151 | + |
| 152 | + |
153 | 153 | @pytest.mark.parametrize(
|
154 | 154 | "client_class", [CloudChannelServiceClient, CloudChannelServiceAsyncClient,]
|
155 | 155 | )
|
@@ -7508,7 +7508,6 @@ def test_cloud_channel_service_transport_auth_adc_old_google_auth(transport_clas
|
7508 | 7508 | (transports.CloudChannelServiceGrpcAsyncIOTransport, grpc_helpers_async),
|
7509 | 7509 | ],
|
7510 | 7510 | )
|
7511 |
| -@requires_api_core_gte_1_26_0 |
7512 | 7511 | def test_cloud_channel_service_transport_create_channel(transport_class, grpc_helpers):
|
7513 | 7512 | # If credentials and host are not provided, the transport class should use
|
7514 | 7513 | # ADC credentials.
|
@@ -7537,79 +7536,6 @@ def test_cloud_channel_service_transport_create_channel(transport_class, grpc_he
|
7537 | 7536 | )
|
7538 | 7537 |
|
7539 | 7538 |
|
7540 |
| -@pytest.mark.parametrize( |
7541 |
| - "transport_class,grpc_helpers", |
7542 |
| - [ |
7543 |
| - (transports.CloudChannelServiceGrpcTransport, grpc_helpers), |
7544 |
| - (transports.CloudChannelServiceGrpcAsyncIOTransport, grpc_helpers_async), |
7545 |
| - ], |
7546 |
| -) |
7547 |
| -@requires_api_core_lt_1_26_0 |
7548 |
| -def test_cloud_channel_service_transport_create_channel_old_api_core( |
7549 |
| - transport_class, grpc_helpers |
7550 |
| -): |
7551 |
| - # If credentials and host are not provided, the transport class should use |
7552 |
| - # ADC credentials. |
7553 |
| - with mock.patch.object( |
7554 |
| - google.auth, "default", autospec=True |
7555 |
| - ) as adc, mock.patch.object( |
7556 |
| - grpc_helpers, "create_channel", autospec=True |
7557 |
| - ) as create_channel: |
7558 |
| - creds = ga_credentials.AnonymousCredentials() |
7559 |
| - adc.return_value = (creds, None) |
7560 |
| - transport_class(quota_project_id="octopus") |
7561 |
| - |
7562 |
| - create_channel.assert_called_with( |
7563 |
| - "cloudchannel.googleapis.com:443", |
7564 |
| - credentials=creds, |
7565 |
| - credentials_file=None, |
7566 |
| - quota_project_id="octopus", |
7567 |
| - scopes=("https://www.googleapis.com/auth/apps.order",), |
7568 |
| - ssl_credentials=None, |
7569 |
| - options=[ |
7570 |
| - ("grpc.max_send_message_length", -1), |
7571 |
| - ("grpc.max_receive_message_length", -1), |
7572 |
| - ], |
7573 |
| - ) |
7574 |
| - |
7575 |
| - |
7576 |
| -@pytest.mark.parametrize( |
7577 |
| - "transport_class,grpc_helpers", |
7578 |
| - [ |
7579 |
| - (transports.CloudChannelServiceGrpcTransport, grpc_helpers), |
7580 |
| - (transports.CloudChannelServiceGrpcAsyncIOTransport, grpc_helpers_async), |
7581 |
| - ], |
7582 |
| -) |
7583 |
| -@requires_api_core_lt_1_26_0 |
7584 |
| -def test_cloud_channel_service_transport_create_channel_user_scopes( |
7585 |
| - transport_class, grpc_helpers |
7586 |
| -): |
7587 |
| - # If credentials and host are not provided, the transport class should use |
7588 |
| - # ADC credentials. |
7589 |
| - with mock.patch.object( |
7590 |
| - google.auth, "default", autospec=True |
7591 |
| - ) as adc, mock.patch.object( |
7592 |
| - grpc_helpers, "create_channel", autospec=True |
7593 |
| - ) as create_channel: |
7594 |
| - creds = ga_credentials.AnonymousCredentials() |
7595 |
| - adc.return_value = (creds, None) |
7596 |
| - |
7597 |
| - transport_class(quota_project_id="octopus", scopes=["1", "2"]) |
7598 |
| - |
7599 |
| - create_channel.assert_called_with( |
7600 |
| - "cloudchannel.googleapis.com:443", |
7601 |
| - credentials=creds, |
7602 |
| - credentials_file=None, |
7603 |
| - quota_project_id="octopus", |
7604 |
| - scopes=["1", "2"], |
7605 |
| - ssl_credentials=None, |
7606 |
| - options=[ |
7607 |
| - ("grpc.max_send_message_length", -1), |
7608 |
| - ("grpc.max_receive_message_length", -1), |
7609 |
| - ], |
7610 |
| - ) |
7611 |
| - |
7612 |
| - |
7613 | 7539 | @pytest.mark.parametrize(
|
7614 | 7540 | "transport_class",
|
7615 | 7541 | [
|
|
0 commit comments